<?php

namespace app\index\behavior;

/**
 * Description of ActionBegin
 *
 * @author Dongasai
 */
class ActionBegin
{

    public function run()
    {

        if (!config(__CLASS__ . '_run_one')) {
            $this->run_one();
        }
    }

    /**
     * 仅运行一次
     */
    public function run_one()
    {
        config(__CLASS__ . '_run_one', 1);
        //读取登陆用户信息
        $userinfo = \app\index\service\User::userinfo(session('uid'));
        $view     = \think\View::instance();
        $view->assign('userinfo', $userinfo);
    }

}
